from django.views.generic import CreateView, DetailView, ListView

from thirdpart.mixins.mixin import IsSuperuserMixin

from .models import Server

# Create your views here.


class ServerListView(IsSuperuserMixin, ListView):
    model = Server
    template_name = "server/server_list.html"


class ServerUpdateView(IsSuperuserMixin, ListView):
    """更新服务器信息"""

    pass


class ServerCreateView(IsSuperuserMixin, CreateView):
    model = Server
    fields = ["name", "host", "username", "port", "keyfile", "remote_path"]
    template_name = "server/server_add.html"


class ServerDetailView(IsSuperuserMixin, DetailView):
    model = Server
    template_name = "server/server_detail.html"
